var Download = {
    inOpCode: 1,
    DOWNLOAD: "wgt://data/",
    downloadPath: "",
    savedPath: "",
    callback: null,
    download: function(downloadPath, savedPath, callback, resume) {
        Download.inOpCode = Math.floor(Math.random() * ( 100000 + 1));
        Download.downloadPath = downloadPath;
        Download.savedPath = Download.DOWNLOAD+savedPath;
        Download.callback = callback;
        Download.resume = Download.resume ? "1":"0";
        
        var downloader = uexDownloaderMgr.create();
        if(downloader){
            var headJson = '{"Content-type":"application/json;charset=utf-8"}';
            uexDownloaderMgr.setHeaders(downloader, headJson);
            
            uexDownloaderMgr.download(downloader,
                 downloadPath, 
                 "wgt://"+Download.inOpCode+".png",
                 1, 
                 function(fileSize, percent, status){
                          switch (status) {
                              case 0:
                                  return;
                              break;
                              case 1:
                                  uexDownloaderMgr.closeDownloader(downloader);
                                  var realPath = uexFileMgr.getFileRealPath("wgt://"+Download.inOpCode+".png");
                                  Download.callback(realPath);
                              break;
                              case 2:
                                  uexDownloaderMgr.closeDownloader(downloader);
                              break;
                              }                  
            });
        }
        
        
       
    }
    
}